{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-15T01:11:01.282054Z",
     "start_time": "2019-08-15T01:10:57.975708Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>合作方</th>\n",
       "      <th>用户类型</th>\n",
       "      <th>省份</th>\n",
       "      <th>完成时间</th>\n",
       "      <th>放款金额</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>安徽省</td>\n",
       "      <td>201708</td>\n",
       "      <td>399989.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>山西省</td>\n",
       "      <td>201710</td>\n",
       "      <td>25508.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>BESTPAY</td>\n",
       "      <td>3</td>\n",
       "      <td>山西省</td>\n",
       "      <td>201709</td>\n",
       "      <td>560.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BESTPAY</td>\n",
       "      <td>3</td>\n",
       "      <td>河北省</td>\n",
       "      <td>201709</td>\n",
       "      <td>975.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>ZIYING</td>\n",
       "      <td>1</td>\n",
       "      <td>四川省</td>\n",
       "      <td>201710</td>\n",
       "      <td>5325.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>BESTPAY</td>\n",
       "      <td>3</td>\n",
       "      <td>河北省</td>\n",
       "      <td>201710</td>\n",
       "      <td>39851.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>BESTPAY</td>\n",
       "      <td>3</td>\n",
       "      <td>内蒙古自治区</td>\n",
       "      <td>201710</td>\n",
       "      <td>4584.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>BESTPAY</td>\n",
       "      <td>3</td>\n",
       "      <td>云南省</td>\n",
       "      <td>201710</td>\n",
       "      <td>899.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>新疆维吾尔自治区</td>\n",
       "      <td>201710</td>\n",
       "      <td>1219815.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>河南省</td>\n",
       "      <td>201704</td>\n",
       "      <td>3499659.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>新疆维吾尔自治区</td>\n",
       "      <td>201711</td>\n",
       "      <td>1840226.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>ZIYING</td>\n",
       "      <td>1</td>\n",
       "      <td>河北省</td>\n",
       "      <td>201711</td>\n",
       "      <td>695205.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>ZHAOLIAN</td>\n",
       "      <td>2</td>\n",
       "      <td>山西省</td>\n",
       "      <td>201711</td>\n",
       "      <td>438590.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>201704</td>\n",
       "      <td>84667.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>山东省</td>\n",
       "      <td>201706</td>\n",
       "      <td>842909.46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>201706</td>\n",
       "      <td>42872.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>山东省</td>\n",
       "      <td>201710</td>\n",
       "      <td>315179.94</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>ZIYING</td>\n",
       "      <td>1</td>\n",
       "      <td>甘肃省</td>\n",
       "      <td>201711</td>\n",
       "      <td>34640.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>1</td>\n",
       "      <td>山东省</td>\n",
       "      <td>201711</td>\n",
       "      <td>74026.55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>BESTPAY</td>\n",
       "      <td>3</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>201711</td>\n",
       "      <td>3668.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>ZHAOLIAN</td>\n",
       "      <td>2</td>\n",
       "      <td>山东省</td>\n",
       "      <td>201809</td>\n",
       "      <td>13252452.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>1</td>\n",
       "      <td>广东省</td>\n",
       "      <td>201806</td>\n",
       "      <td>2996869.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>201712</td>\n",
       "      <td>11402944.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>广东省</td>\n",
       "      <td>201712</td>\n",
       "      <td>9263010.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>1</td>\n",
       "      <td>安徽省</td>\n",
       "      <td>201712</td>\n",
       "      <td>1022905.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>内蒙古自治区</td>\n",
       "      <td>201712</td>\n",
       "      <td>2633226.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>1</td>\n",
       "      <td>湖北省</td>\n",
       "      <td>201712</td>\n",
       "      <td>891842.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>1</td>\n",
       "      <td>新疆维吾尔自治区</td>\n",
       "      <td>201712</td>\n",
       "      <td>1959197.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>1</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>201712</td>\n",
       "      <td>7930400.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>BESTPAY</td>\n",
       "      <td>3</td>\n",
       "      <td>内蒙古自治区</td>\n",
       "      <td>201712</td>\n",
       "      <td>21483.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3544</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>1</td>\n",
       "      <td>广西壮族自治区</td>\n",
       "      <td>201905</td>\n",
       "      <td>14252.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3545</th>\n",
       "      <td>HUABEI</td>\n",
       "      <td>6</td>\n",
       "      <td>青海省</td>\n",
       "      <td>201905</td>\n",
       "      <td>77086.56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3546</th>\n",
       "      <td>ZHONGAN</td>\n",
       "      <td>4</td>\n",
       "      <td>河北省</td>\n",
       "      <td>201905</td>\n",
       "      <td>585.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3547</th>\n",
       "      <td>WEIXIN</td>\n",
       "      <td>2</td>\n",
       "      <td>上海市</td>\n",
       "      <td>201905</td>\n",
       "      <td>390.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3548</th>\n",
       "      <td>DELEKEJI</td>\n",
       "      <td>9</td>\n",
       "      <td>广东省</td>\n",
       "      <td>201905</td>\n",
       "      <td>118442.85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3549</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>河北省</td>\n",
       "      <td>201906</td>\n",
       "      <td>184108.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3550</th>\n",
       "      <td>HUABEI</td>\n",
       "      <td>6</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>201906</td>\n",
       "      <td>8237996.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3551</th>\n",
       "      <td>HUABEI</td>\n",
       "      <td>6</td>\n",
       "      <td>湖北省</td>\n",
       "      <td>201906</td>\n",
       "      <td>12055879.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3552</th>\n",
       "      <td>ZHAOLIAN</td>\n",
       "      <td>2</td>\n",
       "      <td>山东省</td>\n",
       "      <td>201906</td>\n",
       "      <td>10232561.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3553</th>\n",
       "      <td>MASHANGXIAOJIN</td>\n",
       "      <td>2</td>\n",
       "      <td>安徽省</td>\n",
       "      <td>201906</td>\n",
       "      <td>2441069.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3554</th>\n",
       "      <td>MASHANGXIAOJIN</td>\n",
       "      <td>2</td>\n",
       "      <td>贵州省</td>\n",
       "      <td>201906</td>\n",
       "      <td>5159887.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3555</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>江西省</td>\n",
       "      <td>201906</td>\n",
       "      <td>6630416.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3556</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>陕西省</td>\n",
       "      <td>201906</td>\n",
       "      <td>4834450.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3557</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>河南省</td>\n",
       "      <td>201906</td>\n",
       "      <td>215662.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3558</th>\n",
       "      <td>JINGDONG</td>\n",
       "      <td>7</td>\n",
       "      <td>河北省</td>\n",
       "      <td>201906</td>\n",
       "      <td>325074.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3559</th>\n",
       "      <td>XINGYEXIAOJIN</td>\n",
       "      <td>2</td>\n",
       "      <td>湖北省</td>\n",
       "      <td>201906</td>\n",
       "      <td>1001876.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3560</th>\n",
       "      <td>HUABEI</td>\n",
       "      <td>6</td>\n",
       "      <td>宁夏回族自治区</td>\n",
       "      <td>201906</td>\n",
       "      <td>832024.89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3561</th>\n",
       "      <td>DELEKEJI</td>\n",
       "      <td>9</td>\n",
       "      <td>四川省</td>\n",
       "      <td>201906</td>\n",
       "      <td>274355.19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3562</th>\n",
       "      <td>ZHAOLIAN</td>\n",
       "      <td>2</td>\n",
       "      <td>吉林省</td>\n",
       "      <td>201906</td>\n",
       "      <td>109097.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3563</th>\n",
       "      <td>DELEKEJI</td>\n",
       "      <td>9</td>\n",
       "      <td>山东省</td>\n",
       "      <td>201906</td>\n",
       "      <td>104864.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3564</th>\n",
       "      <td>ZHAOLIAN</td>\n",
       "      <td>5</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>201906</td>\n",
       "      <td>23450.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3565</th>\n",
       "      <td>MASHANGXIAOJIN</td>\n",
       "      <td>2</td>\n",
       "      <td>海南省</td>\n",
       "      <td>201906</td>\n",
       "      <td>95564.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3566</th>\n",
       "      <td>ZHAOLIAN</td>\n",
       "      <td>2</td>\n",
       "      <td>上海市</td>\n",
       "      <td>201906</td>\n",
       "      <td>9137.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3567</th>\n",
       "      <td>HUABEI</td>\n",
       "      <td>6</td>\n",
       "      <td>山西</td>\n",
       "      <td>201906</td>\n",
       "      <td>2399.73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3568</th>\n",
       "      <td>DELEKEJI</td>\n",
       "      <td>9</td>\n",
       "      <td>江苏省</td>\n",
       "      <td>201906</td>\n",
       "      <td>96828.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3569</th>\n",
       "      <td>JINGDONG</td>\n",
       "      <td>7</td>\n",
       "      <td>浙江省</td>\n",
       "      <td>201906</td>\n",
       "      <td>6097.11</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3570</th>\n",
       "      <td>WEIXIN</td>\n",
       "      <td>2</td>\n",
       "      <td>湖南省</td>\n",
       "      <td>201906</td>\n",
       "      <td>2420729.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3571</th>\n",
       "      <td>WEIXIN</td>\n",
       "      <td>2</td>\n",
       "      <td>四川省</td>\n",
       "      <td>201906</td>\n",
       "      <td>275706.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3572</th>\n",
       "      <td>DUMIAO</td>\n",
       "      <td>2</td>\n",
       "      <td>广东省</td>\n",
       "      <td>201906</td>\n",
       "      <td>226881.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3573</th>\n",
       "      <td>DELEKEJI</td>\n",
       "      <td>9</td>\n",
       "      <td>福建省</td>\n",
       "      <td>201906</td>\n",
       "      <td>161778.21</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3574 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 合作方  用户类型        省份    完成时间         放款金额\n",
       "0             DUMIAO     2       安徽省  201708    399989.00\n",
       "1             DUMIAO     2       山西省  201710     25508.00\n",
       "2            BESTPAY     3       山西省  201709       560.00\n",
       "3            BESTPAY     3       河北省  201709       975.00\n",
       "4             ZIYING     1       四川省  201710      5325.00\n",
       "5            BESTPAY     3       河北省  201710     39851.00\n",
       "6            BESTPAY     3    内蒙古自治区  201710      4584.00\n",
       "7            BESTPAY     3       云南省  201710       899.00\n",
       "8             DUMIAO     2  新疆维吾尔自治区  201710   1219815.00\n",
       "9             DUMIAO     2       河南省  201704   3499659.00\n",
       "10            DUMIAO     2  新疆维吾尔自治区  201711   1840226.00\n",
       "11            ZIYING     1       河北省  201711    695205.00\n",
       "12          ZHAOLIAN     2       山西省  201711    438590.00\n",
       "13            DUMIAO     2       浙江省  201704     84667.00\n",
       "14            DUMIAO     2       山东省  201706    842909.46\n",
       "15            DUMIAO     2       浙江省  201706     42872.00\n",
       "16            DUMIAO     2       山东省  201710    315179.94\n",
       "17            ZIYING     1       甘肃省  201711     34640.00\n",
       "18           ZHONGAN     1       山东省  201711     74026.55\n",
       "19           BESTPAY     3       浙江省  201711      3668.00\n",
       "20          ZHAOLIAN     2       山东省  201809  13252452.00\n",
       "21           ZHONGAN     1       广东省  201806   2996869.00\n",
       "22            DUMIAO     2       浙江省  201712  11402944.00\n",
       "23            DUMIAO     2       广东省  201712   9263010.00\n",
       "24           ZHONGAN     1       安徽省  201712   1022905.00\n",
       "25            DUMIAO     2    内蒙古自治区  201712   2633226.06\n",
       "26           ZHONGAN     1       湖北省  201712    891842.00\n",
       "27           ZHONGAN     1  新疆维吾尔自治区  201712   1959197.00\n",
       "28           ZHONGAN     1       浙江省  201712   7930400.00\n",
       "29           BESTPAY     3    内蒙古自治区  201712     21483.00\n",
       "...              ...   ...       ...     ...          ...\n",
       "3544         ZHONGAN     1   广西壮族自治区  201905     14252.00\n",
       "3545          HUABEI     6       青海省  201905     77086.56\n",
       "3546         ZHONGAN     4       河北省  201905       585.00\n",
       "3547          WEIXIN     2       上海市  201905       390.00\n",
       "3548        DELEKEJI     9       广东省  201905    118442.85\n",
       "3549          DUMIAO     2       河北省  201906    184108.00\n",
       "3550          HUABEI     6       浙江省  201906   8237996.34\n",
       "3551          HUABEI     6       湖北省  201906  12055879.44\n",
       "3552        ZHAOLIAN     2       山东省  201906  10232561.00\n",
       "3553  MASHANGXIAOJIN     2       安徽省  201906   2441069.00\n",
       "3554  MASHANGXIAOJIN     2       贵州省  201906   5159887.00\n",
       "3555          DUMIAO     2       江西省  201906   6630416.00\n",
       "3556          DUMIAO     2       陕西省  201906   4834450.00\n",
       "3557          DUMIAO     2       河南省  201906    215662.00\n",
       "3558        JINGDONG     7       河北省  201906    325074.24\n",
       "3559   XINGYEXIAOJIN     2       湖北省  201906   1001876.00\n",
       "3560          HUABEI     6   宁夏回族自治区  201906    832024.89\n",
       "3561        DELEKEJI     9       四川省  201906    274355.19\n",
       "3562        ZHAOLIAN     2       吉林省  201906    109097.00\n",
       "3563        DELEKEJI     9       山东省  201906    104864.88\n",
       "3564        ZHAOLIAN     5       江苏省  201906     23450.00\n",
       "3565  MASHANGXIAOJIN     2       海南省  201906     95564.00\n",
       "3566        ZHAOLIAN     2       上海市  201906      9137.00\n",
       "3567          HUABEI     6        山西  201906      2399.73\n",
       "3568        DELEKEJI     9       江苏省  201906     96828.06\n",
       "3569        JINGDONG     7       浙江省  201906      6097.11\n",
       "3570          WEIXIN     2       湖南省  201906   2420729.00\n",
       "3571          WEIXIN     2       四川省  201906    275706.00\n",
       "3572          DUMIAO     2       广东省  201906    226881.00\n",
       "3573        DELEKEJI     9       福建省  201906    161778.21\n",
       "\n",
       "[3574 rows x 5 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 导入百融csv文件\n",
    "import pandas as pd\n",
    "import os\n",
    "os.chdir(r'D:\\vintage处理')\n",
    "df=pd.read_csv('vintage.csv',low_memory=False)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-08-15T01:11:48.398622Z",
     "start_time": "2019-08-15T01:11:39.814552Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "success!\n"
     ]
    }
   ],
   "source": [
    "def mob(x,y):\n",
    "    month = int(str(x['完成时间'])[4:])\n",
    "    if month + y <=12:\n",
    "        b_month = x['完成时间'] + y\n",
    "    elif month + y > 12 and month + y <=24:\n",
    "        b_month = x['完成时间'] + y + 88\n",
    "    elif month + y > 24:\n",
    "        b_month = x['完成时间'] + y + 176\n",
    "    return b_month\n",
    "\n",
    "last = pd.DataFrame()\n",
    "for i in range(1,25):\n",
    "    df1=df.copy()\n",
    "    df1['MOB']=i\n",
    "    df1['账期']=df1.apply(lambda x:mob(x,i),axis=1)\n",
    "    last = last.append(df1)\n",
    "last = last[last['账期']<=201907]\n",
    "\n",
    "#         x['MOB'] = j\n",
    "#         x['账期'] = b_month\n",
    "#         last = last.append(x,ignore_index=True,sort=False)\n",
    "# #         last = pd.concat([last,x],ignore_index=True,sort=False)\n",
    "#         j += 1\n",
    "last.to_excel('ss.xlsx')\n",
    "print('success!')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
